home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xpaint-2.1.1 / xpaint.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  3KB  |  92 lines

  1. /* +-------------------------------------------------------------------+ */
  2. /* | Copyright 1992, 1993, David Koblas (koblas@netcom.com)            | */
  3. /* |                                                                   | */
  4. /* | Permission to use, copy, modify, and to distribute this software  | */
  5. /* | and its documentation for any purpose is hereby granted without   | */
  6. /* | fee, provided that the above copyright notice appear in all       | */
  7. /* | copies and that both that copyright notice and this permission    | */
  8. /* | notice appear in supporting documentation.  There is no           | */
  9. /* | representations about the suitability of this software for        | */
  10. /* | any purpose.  this software is provided "as is" without express   | */
  11. /* | or implied warranty.                                              | */
  12. /* |                                                                   | */
  13. /* +-------------------------------------------------------------------+ */
  14.  
  15. #ifndef MIN
  16. #define MIN(a,b)    (((a) < (b)) ? (a) : (b))
  17. #endif
  18. #ifndef MAX
  19. #define MAX(a,b)    (((a) > (b)) ? (a) : (b))
  20. #endif
  21. #ifndef ABS
  22. #define ABS(a)        ((a > 0) ? (a) : 0 - (a))
  23. #endif
  24. #ifndef SIGN
  25. #define SIGN(a)        ((a > 0) ? 1 : -1)
  26. #endif
  27.  
  28. #ifdef __STDC__
  29. #define CONCAT(a,b)    a##b
  30. #else
  31. #define CONCAT(a,b)    a/**/b
  32. #endif
  33.  
  34. #ifdef AIXV3
  35. #ifdef NULL
  36. #undef NULL
  37. #endif /* NULL */
  38. #define NULL 0
  39. #endif /* AIXV3 */
  40.  
  41. extern struct Global_s {
  42.     struct {
  43.         void        *image;
  44.         Colormap    cmap;
  45.         int        width, height;
  46.         Pixmap        pix, mask;
  47.     } region;
  48.     Display        *display;
  49.     XtAppContext    appContext;
  50.     Boolean        timeToDie;
  51.     Time        currentTime;
  52. } Global;
  53.  
  54. typedef    void        *(*OperationFunc)(Widget, ...);
  55.  
  56. typedef void    *(*OperationAddProc)(Widget);
  57. typedef void    (*OperationRemoveProc)(Widget, void *);
  58. typedef OperationFunc    Operation_t;
  59.  
  60.  
  61. #ifdef DEFINE_GLOBAL
  62. #define EXTERN(var, val)    var = val ;
  63. #else
  64. #define EXTERN(var, val)    extern var ;
  65. #endif
  66.  
  67. EXTERN(Operation_t *CurrentOp, NULL)
  68. #ifdef DEFINE_GLOBAL
  69. struct Global_s Global;
  70. #endif
  71.  
  72. extern void     BrushSelect(Widget);
  73. extern void     FontSelect(Widget, Widget);
  74. extern void    GraphicCreate(Widget, int);
  75. extern Widget    AddPattern(Widget, Widget, Pixmap, Pixel);
  76. extern Widget    AddPatternInfo(void*, Pixmap, Pixel);
  77. extern void    ChangePattern(void *, Pixmap);
  78. extern void    SizeSelect(Widget, Widget, void (*)(Widget,int,int,int));
  79.  
  80. extern void    StdSaveFile(Widget, XtPointer, XtPointer);
  81. extern void    StdSaveRegionFile(Widget, XtPointer, XtPointer);
  82.  
  83. extern void    OperationAddArg(Arg);
  84. extern void    OperationSetPaint(Widget);
  85. extern void    OperationSet(String[],int);
  86.  
  87. #define XYtoRECT(x1,y1,x2,y2,rect)                    \
  88.             (rect)->x = MIN(x1,x2);             \
  89.             (rect)->y = MIN(y1,y2);                \
  90.             (rect)->width = MAX(x1,x2) - (rect)->x + 1;    \
  91.             (rect)->height = MAX(y1,y2) - (rect)->y + 1;
  92.